perm filename SAILO[S,TES] blob
sn#009961 filedate 1972-09-21 generic text, type T, neo UTF8
00100
00200
00300
00400
00500
00600
00700
00800
00900
01000
01100
01200
01300
01400 SOME DIFFERENCES BETWEEN SAIL AND ALGOL-60
01500
01600 Larry Tesler
01700 September 1972
01800
01900
02000
02100
02200
02300
02400
02500
02600
02700
02800 This is intended to introduce new users of SAIL to the system if
02900 they are already familiar with Algol-60. At first, the user shoulld
03000 be able to produce small programs with occasional reference to the
03100 SAIL Manual proper. Eventually, it is recommended that the entire
03200 SAIL Manual be read.
00100 IDENTIFIERS
00200
00300 Capital and small letters are not distinguished. These are all the
00400 same to SAIL:
00500
00600 alpha
00700 Alpha
00800 ALPHA
00900
01000 Although the length of an identifier is unlimited, it is recommended
01100 that it be distinguishable by its first six characters. [Only the
01200 first six characters are available in the run-time symbol table used
01300 by RAID (DDT). Problems also arise when a large program is broken up
01400 into separately compiled modules, and when an assembly language
01500 program is loaded with a SAIL program.]
01600
01700
01800 PROCEDURES
01900
02000 Types of formal parameters are specified within the parentheses of
02100 the procedure declaration, along with the names of the parameters.
02200
02300 PROCEDURE P(INTEGER A, B; STRING S) ;
02400
02500 Numbers and strings are passed by value and arrays by location. To
02600 pass a simple variable by location, use the qualifier REFERENCE in
02700 the procedure declaration.
02800
02900 PROCEDURE Q(REFERENCE INTEGER I; INTEGER ARRAY P) ;
03000 P[I] ← I ← 4*I + 1 ;
03100
03200 There is no Algol-call-by-name; i.e., if an expression is an actual
03300 parameter, it is evaluated only once, at the time of the call.
03400
03500 A recursive procedure must be declared as such. A typed procedure
03600 must have a RETURN statement somewhere in its body.
03700
03800 RECURSIVE INTEGER PROCEDURE FACTORIAL(INTEGER N) ;
03900 RETURN(IF N=0 THEN 1 ELSE N * FACTORIAL(N-1)) ;
04000
04100
04200 ARITHMETIC OPERATORS
04300
04400 Multiplication *
04500
04600 Division / % The latter is integer division INT%INT→INT
04700
04800 Modulus MOD Uses infix notation: A MOD B
04900
00100 CONSTANTS
00200
00300 Real 6.4@-7 = .00000064
00400
00500 Integer -14
00600
00700 String "This is how to get a "" into a string"
00800
00900 Octal Integer '7677
01000
01100
01200 STRING OPERATORS
01300
01400 Automatic conversion of small octal character code to string value
01500
01600 CR ← '15 ; LF ← '12 ;
01700
01800 Concatenation
01900
02000 B ← "Long " & "message." & CR ;
02100
02200 Function CVS to convert integer to string for output
02300
02400 STR ← CVS(14-J)
02500
02600 Function OUTSTR to output a string to the terminal
02700
02800 OUTSTR("This is a " & B & LF & " X = " & CVS(X) & CR & LF) ;
02900
03000 Equality of strings
03100
03200 IF EQU(STR, "D<<@.") THEN ...
03300
03400 Length of a string
03500
03600 L ← LENGTH(STR)
03700
03800 Substring
03900
04000 STR[4 TO 7]
04100 B[∞-6 TO ∞] ...∞ means last character
04200
04300 ITERATION
04400
04500 FOR I ← A+B STEP C-1 UNTIL Q*R DO ...
04600
04700 In the above, A+B and C-1 are evaluated just once each, but Q*R is
04800 evaluated each time through the loop. But if the STEP expression is
04900 a simple variable, it is re-evaluated every time too.
05000
05100 WHILE A<0 OR B>0 DO ...
05200
05300 DO ... UNTIL (BOOL ∨ ¬LOOB) ∧ Q>Y≥0
00100 OTHER FEATURES OF SAIL (SEE MANUAL FOR DETAILS)
00200
00300
00400 The `*' marks facilities recently added to SAIL and not yet
00500 in the manual. See SAIL.NEW[UP,DOC]
00600
00700 CASE Statements and Expressions
00800
00900 *SIMPLE PROCEDURES Extra efficiency, a few restrictions
01000
01100 SCAN, INPUT String scanning, file input
01200
01300 LEAP Powerful associative processor, set and list
01400 operations
01500
01600 *Multiple processes
01700
01800 *Macros and Conditional Assembly